home *** CD-ROM | disk | FTP | other *** search
/ ftp.cs.arizona.edu / ftp.cs.arizona.edu.tar / ftp.cs.arizona.edu / icon / newsgrp / group98b.txt / 000042_icon-group-sender _Wed May 27 08:20:59 1998.msg < prev    next >
Internet Message Format  |  2000-09-20  |  3KB

  1. Return-Path: <icon-group-sender>
  2. Received: from kingfisher.CS.Arizona.EDU (kingfisher.CS.Arizona.EDU [192.12.69.239])
  3.     by baskerville.CS.Arizona.EDU (8.8.8/8.8.7) with SMTP id IAA03009
  4.     for <icon-group-addresses@baskerville.CS.Arizona.EDU>; Wed, 27 May 1998 08:20:58 -0700 (MST)
  5. Received: by kingfisher.CS.Arizona.EDU (5.65v4.0/1.1.8.2/08Nov94-0446PM)
  6.     id AA32250; Wed, 27 May 1998 08:20:52 -0700
  7. Message-Id: <4FD6422BE942D111908D00805F3158DF0757B2CE@red-msg-52.dns.microsoft.com>
  8. From: Todd Proebsting <toddpro@microsoft.com>
  9. To: "'Guy Laden'" <guy@math.tau.ac.il>, icon-group@baskerville.CS.Arizona.EDU
  10. Subject: RE: Writing compilers in Icon
  11. Date: Tue, 26 May 1998 13:22:48 -0700
  12. X-Mailer: Internet Mail Service (5.5.2328.0)
  13. Errors-To: icon-group-errors@optima.CS.Arizona.EDU
  14. Status: RO
  15. Content-Length: 2106
  16.  
  17. I really enjoyed writing Jcon's translator in Icon.  (I had help from Denise
  18. Todd, Bob Alexander and Gregg Townsend.)  I made little use of goal-directed
  19. evaluation, although generators were great fun to use.  In fact, the whole
  20. translator setup is based on a series of co-expressions that feed one
  21. another as a series of filters, which would have been very painful without
  22. generators.  For instance, to translate a file, file.icn, into ucode files
  23. file.u1 and file.u2, the magic incantation is
  24.  
  25. % jtran preproc file.icn : yylex : parse : u_gen_File -out:file
  26.  
  27. This directs the translator to create a 4-stage pipe: preprocessing, lexing,
  28. parsing, and generating ucode.  Each stage is a co-expression that eats the
  29. output of the previous co-expression as input.  For fun, try the following
  30. pipelines:
  31.  
  32. % jtran preproc file.icn : echo
  33. % jtran preproc file.icn : yylex : echo
  34. % jtran preproc file.icn : yylex : parse : echo
  35.  
  36. Each will give you some idea as to what each stage communicates to the next.
  37.  
  38. (NOTE:  The colons must be separated from the commands by whitespace.  Also,
  39. "echo" filter can be given a "-verbose" flag for really chatty output.)
  40.  
  41. I don't have an Icon grammar that is suitable for recursive-descent parsing,
  42. BUT jtran has just such a parser in it.  Check the file tran/parse.icn.
  43. (The command above that ends in "parse : echo" will give you some idea of
  44. the abstract syntax trees built by the parser.)
  45.  
  46. Todd
  47.  
  48. -----Original Message-----
  49. From: Guy Laden [mailto:guy@math.tau.ac.il]
  50. Sent: Friday, May 22, 1998 1:15 PM
  51. To: icon-group@baskerville.CS.Arizona.EDU
  52. Subject: Writing compilers in Icon
  53.  
  54.  
  55. I noticed the newly announced implementation of Jcon is written in Icon. 
  56. I was wondering whether anybody can comment on how suitable they 
  57. find Icon for writing compilers? Do any of Icon's unique features
  58. prove especially useful for this task? I'm wondering more about
  59. generators and goal-directed evaluation; the built-in data-structures 
  60. are obviously useful.
  61.  
  62. btw, does anybody have an Icon grammar they are willing to share
  63. that is suitable for recursive descent parsing?
  64.  
  65. Regards,
  66. Guy.
  67.